package Nisha.collections;

//import java.util.List;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;



class A
{
	
}
class Employee implements Comparable<Object>
{
	int empId;
	String name;
	public Employee(int empId,String name)
	{
		this.empId = empId;
		this.name = name;
	}

	@Override
	public int compareTo(Object arg0) {
	int empId = ((Employee)arg0).empId;
	if(this.empId>empId)
       return 1;
	else if(this.empId==empId)
		return 0;
	else
		return -1;
	}
	
	@Override
	public String toString() {
		
		return this.empId+" "+this.name;
	}
	
}
public class ArrayListDemo {

	public static void main(String[] args) {
		ArrayList<Employee> emp = new ArrayList<Employee>();
		Employee emp1  = new Employee(03, "Nisha");
		Employee emp2  = new Employee(02, "Payal");
        emp.add(emp1);
        emp.add(emp2);
        Collections.sort(emp);
      System.out.println(emp);
      
      A a = new A();
	}

}
